<?php
/**
 * 功能: 维易消息管理.
 * User: WD
 * Date: 2018/9/11 0011
 * Time: 11:55
 */

namespace app\admin\controller;
use app\base\controller\Power;
use think\Db;

class Remind extends Power{
    protected $beforeActionList = [
        'first',

    ];
    protected function first(){
        $result = $this->testing();
    }
    /**
     * 维易消息列表
     */
    public function index(){
        $remind = Db::name('remind')->order('time desc')->paginate(10);
        $count  = Db::name('remind')->count();
        $this->assign([
            'remind'=>$remind,
            'count'=>$count,
            'empty'=>'<tr class="text-c empty"><td colspan="5">暂无数据</td></tr>'
        ]);
        return view('');

    }
    /**
     * 修改状态
     */
    public function read(){
        $res = Db::name('remind')->where('is_read',1)->update(['is_read'=>2]);
        if($res){
            return json(['msg'=>'已查看','ok'=>true]);
        }else{
            return json(['msg'=>'查看修改失败','ok'=>false]);
        }
    }

}